/* retlib.c */
/* This program has a buffer overflow vulnerability. */
/* Our task is to exploit this vulnerability */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

//by 20145221

int bof(FILE *badfile)
{
	char buffer[12];
/* The following statement has a buffer overflow problem */
	fread(buffer, sizeof(char), 40, badfile);
	return 1;
}

int main(int argc, char **argv)
{
	FILE *badfile;
	badfile = fopen("badfile", "r");
	bof(badfile);
	printf("Returned Properly\n");
	fclose(badfile);
	return 1;
}
